Dynamic Hardware Watchpoint

ABSTRACT

An apparatus for monitoring changes to a block of data is disclosed. A first hardware watchpoint is set to monitor changes to the block of data at a current location of the block of data in memory and a second hardware watchpoint is set to monitor changes at a selected location in the memory where a reference to the block of data is located. Responsive to the second hardware watchpoint being triggered by a change at the selected location where the reference to the block of data is located, a new location of the block of data in the memory is identified based on the change that triggered the second hardware watchpoint. Subsequent to identifying the new location of the block of data, the first hardware watchpoint is reset to monitor changes to the block of data at the new location of the block of data.

This application is a continuation of application Ser. No. 13/559,712,filed Jul. 27, 2012.

BACKGROUND

1. Field

The disclosure relates generally to monitoring data in memory and inparticular, to monitoring references in memory to data in memory. Stillmore particularly, the present disclosure relates to an apparatus andcomputer program product for using hardware watchpoints to monitorchanges to a block of data in memory and to a reference in memory to theblock of data.

2. Description of the Related Art

Data processing systems provide computing resources, such as a computerthat includes a central processing unit and computer memory. Executableprograms are executed by the central processing unit in the computerusing the computer memory. The executable programs store and use data inthe form of data structures located in the computer memory. Duringexecution of the executable programs the information located in thesedata structures may become corrupted by unforeseen errors in theexecutable programs. Responsive to the corruption of a data structure, asubsequent error is likely to occur at unexpected points of execution inthe program.

Service teams are tasked with servicing errors in executable programs.Identifying an error in an executable program can be a difficult taskfor the service team. In particular, identifying an error of the typewhere a data structure has been corrupted can be very difficult. Thereason for this difficulty is that the point in code where an errorshows up is typically not the point in code where the data structure hasbeen corrupted.

Executable programs also store and use pointers to data structures inthe form of a reference located in the computer memory to the locationin memory where the data structure is located. Through the use of areference to a data structure, the data structure can be dynamicallyrel. For example, during execution of an executable program a datastructure can be copied to a new location and a reference to the datastructure can be changed to point to the new location where the datastructure has been copied.

To locate changes to data in memory some computers provide a mechanismcalled a hardware watchpoint. The hardware watchpoint monitors changesto data at a location in memory. However, because the data structure maybe relocated during execution, a hardware watchpoint that is monitoringthe location in memory where a data structure was previously locatedwill not monitor changes to the data structure at a location where thedata structure has been moved. Hardware watchpoints are fast but theyhave limits. For example, a computer will typically support only a smallnumber of hardware watchpoints and the amount of memory a hardwarewatchpoint can watch is also limited.

Another mechanism that can be used to locate changes to data in memoryis called a software watchpoint. Software watchpoints are not limited inthe same ways as hardware watchpoints. Software watchpoints, however,are implemented by single stepping through an executable program andchecking the software watchpoint at each step. Single stepping anexecutable program to process a software watchpoint will significantlyslow down execution of the program. This slowdown can also change thesequence of operations of the executable program due to changes to thetiming of the execution of the program. Changing the sequence and/orslowing down execution of the program can make errors un-reproducibleand can also introduce different errors that would not normally show upduring normal execution. Because of these problems, software watchpointsare not used in production environments where the executable programwould otherwise become un-useable for its original intended purposes.

Therefore, it would be advantageous to have an apparatus and computerprogram product that takes into account at least some of the issuesdiscussed above, as well as possibly other issues.

SUMMARY

In one illustrative embodiment, an apparatus and computer programproduct for monitoring changes to a block of data is provided. Anapparatus sets a first hardware watchpoint to monitor changes to theblock of data at a current location of the block of data in memory and asecond hardware watchpoint to monitor changes at a selected location inthe memory where a reference to the block of data is located. Responsiveto the second hardware watchpoint being triggered by a change at theselected location where the reference to the block of data is located,the apparatus identifies a new location of the block of data in thememory based on the change that triggered the second hardwarewatchpoint. Subsequent to identifying the new location of the block ofdata, the apparatus then resets the first hardware watchpoint to monitorchanges to the block of data at the new location of the block of data.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

FIG. 1 is a block diagram of components involved in monitoring changesto a block of data in a processing environment in accordance with anillustrative embodiment;

FIG. 2 is a table showing an example of the contents of memory involvedin a process for monitoring changes to a block of data in the memory inaccordance with an illustrative embodiment;

FIG. 3 is a flow chart of a process for monitoring changes to a block ofdata in accordance with an illustrative embodiment;

FIG. 4 is a flow chart of a process for monitoring changes to aninstance of a data structure in accordance with an illustrativeembodiment;

FIG. 5 is a flow chart of a process for monitoring changes to a block ofdata in accordance with an illustrative embodiment; and

FIG. 6 is an illustration of a data processing system in accordance withan illustrative embodiment.

DETAILED DESCRIPTION

As will be appreciated by one skilled in the art, aspects of the presentinvention may be embodied as a system, method or computer programproduct. Accordingly, aspects of the present invention may take the formof an entirely hardware embodiment, an entirely software embodiment(including firmware, resident software, micro-code, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”Furthermore, aspects of the present invention may take the form of acomputer program product embodied in one or more computer readablemedium(s) having computer readable program code embodied thereon.

Any combination of one or more computer readable medium(s) may beutilized. The computer readable medium may be a computer readable signalmedium or a computer readable storage medium. A computer readablestorage medium may be, for example, but not limited to, an electronic,magnetic, optical, electromagnetic, infrared, or semiconductor system,apparatus, or device, or any suitable combination of the foregoing. Morespecific examples (a non-exhaustive list) of the computer readablestorage medium would include the following: an electrical connectionhaving one or more wires, a portable computer diskette, a hard disk, arandom access memory (RAM), a read-only memory (ROM), an erasableprogrammable read-only memory (EPROM or Flash memory), an optical fiber,a portable compact disc read-only memory (CD-ROM), an optical storagedevice, a magnetic storage device, or any suitable combination of theforegoing. In the context of this document, a computer readable storagemedium may be any tangible medium that can contain, or store a programfor use by or in connection with an instruction execution system,apparatus, or device.

A computer readable signal medium may include a propagated data signalwith computer readable program code embodied therein, for example, inbaseband or as part of a carrier wave. Such a propagated signal may takeany of a variety of forms, including, but not limited to,electro-magnetic, optical, or any suitable combination thereof. Acomputer readable signal medium may be any computer readable medium thatis not a computer readable storage medium and that can communicate,propagate, or transport a program for use by or in connection with aninstruction execution system, apparatus, or device.

Program code embodied on a computer readable medium may be transmittedusing any appropriate medium, including but not limited to wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for aspects of thepresent invention may be written in any combination of one or moreprogramming languages, including an object oriented programming languagesuch as Java, Smalltalk, C++ or the like and conventional proceduralprogramming languages, such as the “C” programming language or similarprogramming languages. The program code may execute entirely on theuser's computer, partly on the user's computer, as a stand-alonesoftware package, partly on the user's computer and partly on a remotecomputer or entirely on the remote computer or server. In the latterscenario, the remote computer may be connected to the user's computerthrough any type of network, including a local area network (LAN) or awide area network (WAN), or the connection may be made to an externalcomputer (for example, through the Internet using an Internet ServiceProvider).

Aspects of the present invention are described below with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems) and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer program instructions. These computer program instructions maybe provided to a processor of a general purpose computer, specialpurpose computer, or other programmable data processing apparatus toproduce a machine, such that the instructions, which execute via theprocessor of the computer or other programmable data processingapparatus, create means for implementing the functions/acts specified inthe flowchart and/or block diagram block or blocks.

These computer program instructions may also be stored in a computerreadable medium that can direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

With reference now to the figures and, in particular, with reference toFIG. 1, an illustration of components involved in monitoring changes toa block of data in a processing environment is depicted in accordancewith an illustrative embodiment. In this illustrative example, dataprocessing system 102 is present in data processing environment 100.Data processing system 102 may comprise a set of computers. A “set,” asused herein with reference to items, means one or more items. Forexample, “set of computers” is one or more computers. When more than onecomputer is present in data processing system 102, those computers maybe in communication with each other. This communication may befacilitated through a medium such as a network. This network may be, forexample, without limitation, a local area network, a wide area network,an intranet, the internet, and some other suitable type of network.

In these illustrative examples, program source code 104 may be locatedin data processing system 102. Program source code 104 may comprise anumber of statically defined elements, such as static elements 106. Twoexamples of statically defined elements in static elements 106 includedata structure 108 and pointer to data structure 110. Program sourcecode 104 may be written in any programming language suitable forexecution on data processing systems such as data processing system 102.For example, a programming language for program source code 104 maydefine syntax for creating data structures and pointers to the datastructures in program source code 104. The syntax used to define datastructures and pointers may vary significantly between differentprogramming languages. For example, some object oriented programminglanguages may use classes instead of data structures. Still otherprogramming languages may not explicitly support pointers such aspointer to data structure 110. In this example where pointers are notexplicitly supported by the programming language, pointer to datastructure 110 may instead be an implicit pointer, such as a reference tothe data structure using a name of the data structure. In this examplewhere the language syntax requires using references instead of pointersto data structures, a reference may implicitly point or refer to datastructure 108 by name.

As depicted, data processing system 102 includes executable programs,such as executable program 112. In these illustrative examples,executable program 112 is a program running in data processing system102. For example, executable program 112 may be executed by one or moreprocessing units in one or more computers in data processing system 102using memory 114. Executable program 112 uses data in the form ofinstances of data structures, such as an instance of data structure 108.Executable program 112 also uses references to data structures in theform of instances of pointers, such as an instance of pointer to datastructure 110. In these illustrative examples, instances of datastructures and instances of pointers to data structures are located inmemory 114 at selected locations such as selected location 116. Forexample, when executable program 112 is executing in data processingsystem 102, executable program 112 comprises selected location 116. Inthis example, selected location 116 is a location in memory 114 wherereference 118 is located. Reference 118 is an instance of pointer todata structure 110 in these illustrative examples.

Through the use of reference 118 an instance of data structure 108referred to by reference 118 can be dynamically relocated from a currentlocation in memory 114 to a new location in memory 114. For example,during execution of executable program 112 an instance of data structure108 in a current location in memory 114 can be copied to a new locationin memory 114. In this example, subsequent to copying the instance ofdata structure 108 to the new location, reference 118 is modified topoint to the new location where the data structure has been copied.

In these illustrative examples, memory 114 may contain one or moreblocks of memory such as block of memory 120. As depicted, block ofmemory 120 has base address 122. Base address 122 is the address inmemory 114 where block of memory 120 where is located. For example, baseaddress 122 of block of memory 120 may be an address in memory 114 of adata segment allocated to an instance of executable program 112 runningin data processing system 102. As another example, base address 122 maybe an address in memory 114 of a stack frame allocated for use by afunction in an instance of executable program 112 running in dataprocessing system 102.

As depicted, block of memory 120 may comprise address of reference todata block 124 which points to reference to data block 126. In theseillustrative examples, reference to data block 126 is an instance ofpointer to data structure 110. As also depicted, reference to data block126 comprises address of data block 128. In these illustrative examples,address of data block 128 is the address where data block 130 iscurrently located. In these illustrative examples, data block 130 is aninstance of data structure 108. As further depicted, data block 130comprises information 132. In these illustrative examples, information132 may include changed information 134. For example, during executionof executable program 112 the information stored at the location inmemory where data block 130 is currently located may change, thusforming changed information 134 in information 132. As depicted, datablock 130 may also comprise references, such as reference to anotherdata block 136. For example, the information stored at the location inmemory where data block 130 is currently located may comprise referenceto another data block 136, such as another instance of data block 130 atanother location in memory 114.

Processes 138 are instances of executable programs in a data processingsystem, such as data processing system 102. In these illustrativeexamples, instance of program 140 is an instance of executable program112. Data segment 142 is a block of memory, such as block of memory 120.Data segment 142 is used by instance of program 140 for allocatinginstances of data structures, such as data block 130. Instances of datablocks allocated to data segment 142 may be used by all processes thatare given access to data segment 142. For example, data segment 142 maybe a globally accessible data segment that is shared by two or moreinstances of executable program 112. As another example data segment 142may be a process scoped data segment that is accessable only byfunctions within a particular instance of executable program 112. Stackframe 144 for instance of program 140 is also a block of memory, such asblock of memory 120. Stack frames, such as stack frame 144, are used byinstance of program 140 for allocating instances of data structures,such as data block 130. Stack frames, such as stack frame 144, areallocated when a function is called. Each subsequent function callallocates a new stack frame and places the new stack frame on top of thepreviously allocated stack frames creating a stack of stack frames. Whena function completes its operations, the stack frame allocated for thefunction call is removed from the stack and returned for re-use.Instances of data blocks may be allocated in stack frame 144 when afunction is called. When the function call returns freeing up the stackframe for re-use, the instances of data blocks allocated in stack frame144 are also freed up for re-use.

In these illustrative examples, hardware watchpoint analysis module 146is present in data processing system 102 and uses hardware watchpoints148 to watch locations in memory for changes to data. As depicted,hardware watchpoints 148 comprise first hardware watchpoint 150 andsecond hardware watchpoint 152. As also depicted, first hardwarewatchpoint 150 includes address 154 and second hardware watchpoint 152includes address 156. Address 154 is the location in memory that firsthardware watchpoint 150 monitors for a change to information stored ataddress 154. Address 156 is the location in memory that second hardwarewatchpoint 152 monitors for a change to information stored at address156. For example, in a process for monitoring changes to a block of datahardware watchpoint analysis module 146 may store the address for aninstance of data block 130 in memory into address 154 and an address ofan instance of reference to data block 130, such as reference to datablock 126, in address 156.

For example, a user of hardware watchpoint analysis module 146 may usehardware watchpoint analysis module 146 to monitor changes to instancesof a data structure. In this example, subsequent to requesting hardwarewatchpoint analysis module 146 monitor for changes to an instance ofdata structure 108, hardware watchpoint analysis module 146 may identifywhen executable program 112 is executing in data processing system 102an instance of program 140. Subsequent to identifying instance ofprogram 140, hardware watchpoint analysis module 146 may then identifyan allocation of an instance of data structure 108 as data block 130 andan allocation of instance of pointer to data structure 110 as referenceto data block 126. The identification of data block 130 and reference todata block 126 may be based on hardware watchpoint analysis module 146monitoring for the allocations, receiving a notification that data block130 has been allocated, retrieving information from selected location116, and by any other suitable means. Further in this example,subsequent to the identification of data block 130 and reference to datablock 126 hardware watchpoint analysis module 146 may monitor forchanges to data block 130 and reference to data block 126 by settinghardware watchpoints 148. Still further in this example, subsequent to adynamic relocation of data block 130 from a current location in memory114 to a new location in memory 114, hardware watchpoint analysis module146 may reset hardware watchpoints 148 to adjust for the dynamicrelocation of data block 130 by setting hardware watchpoints 148 towatch the location where data block 130 has been moved.

As depicted, hardware watchpoint analysis module 146 may generate reportof monitored changes 160. For example, hardware watchpoint analysismodule 146 may set address 154 to an instance of data block 130 and alsoset address 156 to an instance of reference to data block 130. In thisexample, responsive to first hardware watch point 150 or second hardwarewatch 152 point being triggered by a change to data in memory 114,hardware watchpoint analysis module 146 may generate report of monitoredchanges 160. In these illustrative examples, report of monitored changes160 may include identification information for data processing system102, data processing environment 100, the process in processes 138 thatmade the change to data in memory 114, an identification of the datablock or reference that was being monitored, the data that was changed,what the data has been changed to, and any other available informationthat is suitable for reporting monitored changes to memory used byexecutable program 112.

The illustration of data processing environment 100 in FIG. 1 is notmeant to imply physical or architectural limitations to the manner inwhich an illustrative embodiment may be implemented. Other components inaddition to and/or in place of the ones illustrated may be used. Somecomponents may be unnecessary. Also, the blocks are presented toillustrate some functional components. One or more of these functionalcomponents may be combined, divided, or combined and divided intodifferent blocks when implementing an illustrative embodiment.

For example data processing system 102 may be a local area network(LAN), a wide area network (WAN), an intranet, the Internet, or somecombination thereof. As another example, additional hardware watchpoints may be used to monitor for other changes at other locations inmemory, such as data segment 142, base address 122, reference to anotherdata block 136, and other suitable locations. In this example, allintervening references in memory 114 that point to a data block beingmonitored, such as data block 130, are assigned a hardware watchpoint,if one is available, to identify changes to the physical location of thedata block being monitored and the physical location of referencespointing to the data block being monitored. As still another example, ina failover process where a block of memory in the memory of failingapplication is being transferred to another instance of the applicationit would be advantageous to reset hardware watchpoints in the failoverinstance. In this example, it would be advantageous to watch forinstances where the base address of a block of memory, such as block ofmemory 120 is changing to identify when the block of memory 120 is beingmoved to the failover instance.

Turning next to FIG. 2, an illustrative example of the contents ofmemory involved in a process for monitoring changes to a block of datain the memory is depicted in table form in accordance with anillustrative embodiment. Computer memory 200 is an example of memory 114in FIG. 1. In particular, base segment address 202 is an example of baseaddress 122 in FIG. 1 of block of memory 120 in FIG. 1 for data segment142 in FIG. 1 for instance of program 120 in FIG. 1. More particularly,string 204 is an example an instance of data structure 108 in FIG. 1.Still more particularly, pointer to string 206 is an example of aninstance pointer to data structure 110 in FIG. 1.

In this illustrative example, string 204 is a data structure comprisinga string which is also known as an array of characters. As depicted, thecontents of string 204 are stored at address ffff-0132 in computermemory 200 and comprise the word “HELLO.” As also depicted, the contentsof pointer to string 206 is located at address ffff-0160 in computermemory 200 and comprise the value ffff-0132 which is the address wherestring 204 is located.

As depicted, a process for monitoring for changes to memory where string204 is located may also include monitoring for changes to memory wherepointer to string 206 is located. For example, to monitor for changes tostring 204 a process may set a first hardware watchpoint to ffff-0132 tomonitor for changes to string 204 and a second hardware watchpoint toffff-0160 to identify if string 204 has been moved. In this example,subsequent to a change to the value of pointer to string 206 at addressffff-0160, such as the value changing from ffff-0132 to ffff-f000, theprocess for monitoring for changes to memory may reset the secondhardware watch point for address ffff-0132 to ffff-f000. Thus, whenstring 204 has been moved or copied to string at new location 208 anychanges to the value “HELLO” may still be monitored even though it hasmoved to a new location. For example, responsive to the string “HELLO”at address ffff-f000 changing to read “HELP” at address ffff-f000 thechange will be identified by the process even through the change did nothappen at the location ffff-0132 where the string “HELLO” was originallylocated.

With reference now to FIG. 3, an illustrative example of a flowchart ofa process for monitoring changes to a block of data is depicted inaccordance with an illustrative embodiment. The steps in FIG. 3 may beimplemented in data processing environment 100 in FIG. 1. In particular,the steps may be implemented in software, hardware, or a combination ofthe two hardware watchpoint analysis module 146 in FIG. 1 in dataprocessing system 102 in FIG. 1.

The process begins by setting a first hardware watchpoint to monitorchanges to a block of data at a current location of the block of data inmemory (step 300). The process sets a second hardware watchpoint tomonitor changes at a selected location in the memory where a referenceto the block of data is located (step 302). The process then waits forthe second hardware watchpoint to be triggered by a change at theselected location where the reference to the block of data is located(step 304). Responsive to the second hardware watchpoint being triggeredby the change at the selected location where the reference to the blockof data is located, the process identifies a new location of the blockof data in the memory based on the change that triggered the secondhardware watchpoint (step 306). Subsequent to identifying the newlocation of the block of data, the process resets the first hardwarewatchpoint to monitor changes to the block of data at the new locationof the block of data (step 308).

With reference now to FIG. 4, an illustrative example of a flowchart ofa process for monitoring changes to an instance of a data structure isdepicted in accordance with an illustrative embodiment. The steps inFIG. 4 may be implemented in data processing environment 100 in FIG. 1.In particular, the steps may be implemented in software, hardware, or acombination of the two hardware watchpoint analysis module 146 in FIG. 1in data processing system 102 in FIG. 1.

The process begins by identifying an instance of a data structure and aninstance of a pointer to the data structure responsive to a programbeing loaded and executed in a computer (step 400). The process sets afirst hardware watchpoint to monitor changes to the instance of the datastructure at a current location of the instance of the data structure inmemory (step 402). The process also sets a second hardware watchpoint tomonitor changes at a selected location in the memory where the instanceof the pointer to the instance of the data structure is located (step404). The process then waits for the second hardware watchpoint to betriggered by a change at the selected location where the instance of thepointer to the instance of the data structure is located (step 406).

Responsive to the second hardware watchpoint being triggered by thechange at the selected location where the instance of the pointer to theinstance of the data structure is located, the process identifies a newlocation of the instance of the data structure in the memory based onthe change that triggered the second hardware watchpoint (step 408).Subsequent to identifying the new location of the instance of the datastructure, the process resets the first hardware watchpoint to monitorchanges to the instance of the data structure at the new location of theinstance of the data structure (step 410).

With reference now to FIG. 5, an illustrative example of a flowchart ofa process for monitoring changes to a block of data is depicted inaccordance with an illustrative embodiment. The steps in FIG. 5 may beimplemented in data processing environment 100 in FIG. 1. In particular,the steps may be implemented in software, hardware, or a combination ofthe two hardware watchpoint analysis module 146 in FIG. 1 in dataprocessing system 102 in FIG. 1.

The process begins by setting a first hardware watchpoint of a computerto monitor changes to a block of data at a current location of the blockof data in memory (step 500). The process also sets a second hardwarewatchpoint of the computer to monitor changes at a selected location inthe memory where a reference to the block of data is located (step 502).The process identifies a relocation of the block of data to a newlocation in the memory (step 504).

Subsequent to identifying the relocation of the block of data, theprocess resets the first hardware watchpoint to monitor changes to theblock of data at the new location of the block of data (step 506).Responsive to a modification of information in the block of data at thenew location where the block of data has been copied, the process thengenerates a report indicating the change to the block of data at the newlocation where the block of data has been copied (step 508) with theprocess terminating thereafter.

Referring to FIG. 6, a block diagram of a computer or data processingsystem is shown in which aspects of the present invention may beimplemented. This system is an example of a computer which may be usedto implement components of FIG. 1, such as hardware watchpoint analysismodule 146, data processing system 102, and processes 138, and in whichcomputer usable code or instructions implementing the processes forembodiments of the present invention may be located.

In the depicted example, the data processing system of FIG. 6 employs ahub architecture including north bridge and memory controller hub(NB/MCH) 602 and south bridge and input/output (I/O) controller hub(SB/ICH) 604. Processing unit 606, main memory 608, and graphicsprocessor 610 are connected to NB/MCH 602. Graphics processor 610 may beconnected to NB/MCH 602 through an accelerated graphics port (AGP).

In the depicted example, local area network (LAN) adapter 612 connectsto SB/ICH 604. Audio adapter 616, keyboard and mouse adapter 620, modem622, read only memory (ROM) 624, disk 626, CD-ROM 630, universal serialbus (USB) ports and other communication ports 632, and PCI/PCIe devices634 connect to SB/ICH 604 through bus 638 and bus 640. PCI/PCIe devices634 may include, for example, Ethernet adapters, add-in cards, and PCcards for notebook computers. PCI uses a card bus controller, while PCIedoes not. ROM 624 may be, for example, a flash binary input/outputsystem (BIOS).

Disk 626 and CD-ROM 630 connect to SB/ICH 604 through bus 640. Disk 626and CD-ROM 630 may use, for example, an integrated drive electronics(IDE) or serial advanced technology attachment (SATA) interface. SuperI/O (SIO) device 636 may be connected to SB/ICH 604.

An operating system runs on processing unit 606 and coordinates andprovides control of various components within the data processing systemof FIG. 6. As a client, the operating system may be a commerciallyavailable operating system such as Microsoft® Windows® (Microsoft andWindows are trademarks of Microsoft Corporation in the United States,other countries, or both). An object-oriented programming system, suchas the Java™ programming system, may run in conjunction with theoperating system and provides calls to the operating system from Java™programs or applications executing on the data processing system (Javais a trademark of Sun Microsystems, Inc. in the United States, othercountries, or both).

As a server, the data processing system of FIG. 6 may be, for example,an IBM® eServer™ pSeries® computer system, running the AdvancedInteractive Executive (AIX®) operating system or the LINUX® operatingsystem (eServer, pSeries and AIX are trademarks of InternationalBusiness Machines Corporation in the United States, other countries, orboth while LINUX is a trademark of Linus Torvalds in the United States,other countries, or both). The data processing system may be a symmetricmultiprocessor (SMP) system including a plurality of processors inprocessing unit 606. Alternatively, a single processor system may beemployed.

Instructions for the operating system, the object-oriented programmingsystem, and applications or programs are located on storage devices,such as disk 626, and may be loaded into main memory 608 for executionby processing unit 606. The processes for embodiments of the presentinvention are performed by processing unit 606 using computer usableprogram code, which may be located in a memory such as, for example,main memory 608, ROM 624, or in one or more peripheral devices, such as,for example, disk 626 and CD-ROM 630.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a”, “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising,” when used in this specification, specify thepresence of stated features, integers, steps, operations, elements,and/or components, but do not preclude the presence or addition of oneor more other features, integers, steps, operations, elements,components, and/or groups thereof.

Thus, illustrative embodiments of the present invention provide acomputer implemented method, data processing system, and computerprogram product for monitoring changes to a block of data.

The flowcharts and block diagrams in the figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof code, which comprises one or more executable instructions forimplementing the specified logical function(s). It should also be notedthat, in some alternative implementations, the functions noted in theblock may occur out of the order noted in the figures. For example, twoblocks shown in succession may, in fact, be executed substantiallyconcurrently, or the blocks may sometimes be executed in the reverseorder, depending upon the functionality involved. It will also be notedthat each block of the block diagrams and/or flowchart illustration, andcombinations of blocks in the block diagrams and/or flowchartillustration, can be implemented by special purpose hardware-basedsystems that perform the specified functions or acts, or combinations ofspecial purpose hardware and computer instructions.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below are intended toinclude any structure, material, or act for performing the function incombination with other claimed elements as specifically claimed. Thedescription of the present invention has been presented for purposes ofillustration and description, but is not intended to be exhaustive orlimited to the invention in the form disclosed. Many modifications andvariations will be apparent to those of ordinary skill in the artwithout departing from the scope and spirit of the invention. Theembodiment was chosen and described in order to best explain theprinciples of the invention and the practical application, and to enableothers of ordinary skill in the art to understand the invention forvarious embodiments with various modifications as are suited to theparticular use contemplated.

What is claimed is:
 1. An apparatus, comprising: a memory storinginstructions and blocks of data, and at least one processing unit forexecuting the instructions for monitoring changes to a block of data inthe blocks of data, the at least one processing unit executing theinstructions to: set a first hardware watchpoint to monitor changes tothe block of data at a current location of the block of data in thememory and a second hardware watchpoint to monitor changes at a selectedlocation in the memory where a reference to the block of data islocated; identify a new location of the block of data in the memorybased on a change at the selected location where the reference to theblock of data is located, responsive to the change triggering the secondhardware watchpoint; and subsequent to identifying the new location ofthe block of data, reset the first hardware watchpoint to monitorchanges to the block of data at the new location of the block of data.2. The apparatus of claim 1 wherein the block of data is an instance ofa data structure, the reference is an instance of a pointer to theinstances of the data structure, and the data structure and the pointerare statically defined elements in a program, and further comprising:identifying the instance of the data structure and the instance of thepointer to the data structure responsive to the program being loaded inthe memory and executed by the at least one processing unit.
 3. Theapparatus of claim 1, wherein the block of data and the reference to theblock of data are located in one or more blocks of memory in the memory.4. The apparatus of claim 3, wherein the one or more blocks of memory inthe memory are allocated to a particular instance of a program in thememory that is being executed by the at least one processing unit. 5.The apparatus of claim 3, wherein the one or more blocks of memory inthe memory are located in a portion of the memory that is shared betweentwo or more processes being executed by the at least one processingunit.
 6. A computer program product for monitoring changes to a block ofdata, the computer program product comprising: a computer readablestorage device; program code, stored on the computer readable storagedevice, for setting a first hardware watchpoint to monitor changes tothe block of data at a current location of the block of data in memoryand a second hardware watchpoint to monitor changes at a selectedlocation in the memory where a reference to the block of data islocated; program code, stored on the computer readable storage device,responsive to the second hardware watchpoint being triggered by a changeat the selected location where the reference to the block of data islocated, for identifying a new location of the block of data in thememory based on the change that triggered the second hardwarewatchpoint; and program code, stored on the computer readable storagedevice, for resetting the first hardware watchpoint to monitor changesto the block of data at the new location of the block of data subsequentto identifying the new location of the block of data.
 7. The computerprogram product of claim 6, wherein the block of data is an instance ofa data structure, the reference is an instance of a pointer to theinstance of the data structure, and the data structure and the pointerare statically defined elements in a program, and further comprising:program code, stored on the computer readable storage device, foridentifying the instance of the data structure and the instance of thepointer to the data structure responsive to the program being loaded andexecuted in a computer.
 8. The computer program product of claim 6,wherein the block of data and the reference to the block of data arelocated in one or more blocks of memory in a computer.
 9. The computerprogram product of claim 8, wherein the one or more blocks of memory inthe computer are allocated to a particular instance of a program in thecomputer.
 10. The computer program product of claim 8, wherein the oneor more blocks of memory in the computer are located in a portion ofmemory shared between two or more processes in the computer.